<html>
    <head>
        <title></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <?php
        include '../admin/Config.php';
        // insert into database
        if (isset($_GET['tenBaiViet'])) {
            $tenBaiViet = $_GET['tenBaiViet'];
            $gioiThieu = '';
            if (isset($_GET['gioiThieu'])) {
                $gioiThieu = $_GET['gioiThieu'];
            }
            $queryThemBaiViet = "INSERT INTO BAIVIET (tenBaiViet, gioiThieu, ngayTao) values ('$tenBaiViet','$gioiThieu', NOW())";
            mysql_query($queryThemBaiViet);
            mysql_close();
            echo 'Tạo bài viết thành công!';
        }
        ?>

        <div>
            <form action="baiViet_themMoi.php" method="get">
                <table>
                    <tr>
                        <td>
                            Tên  bài viết
                        </td>
                        <td>
                            <input name="tenBaiViet" type="text" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                            Giới thiệu
                        </td>
                        <td>
                            <textarea  name="gioiThieu" rows="10" cols="100" >
                            </textarea>
                        </td>
                    </tr>
                </table>
                <input type="submit" value="Ghi nhận" />
            </form>
            <a href="index.php" >Danh sách</a>
        </div>
    </body>
</html>
